﻿using Microsoft.Extensions.ObjectPool;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EssentialWebFramework.Library.ObjectPool
{
    public class SimpleRudeObjectPoolProvider : DefaultObjectPoolProvider
    {
        public override SimpleRudeObjectPool<T> Create<T>(IPooledObjectPolicy<T> policy)
            where T : class
        {
            if (policy == null)
            {
                throw new ArgumentNullException(nameof(policy));
            }

            return new SimpleRudeObjectPool<T>(policy, MaximumRetained);
        }
    }
}
